
#include <BOpenGL>
#include <BRender>
#include "member_BViewer.h"
#include "member_BHandler.h"
#include "member_BCamera.h"

using namespace BWE;

member_BViewer::member_BViewer(BViewer* viewer)
{
	boss = viewer;
}
member_BViewer::~member_BViewer()
{

}

void member_BViewer::paintHandler(BHandler* handler, BPainter& painter)
{
	if (!handler || !handler->able())
		return;
	handler_member(handler)->paint(painter);
	for (int i = 0; i < handler_member(handler)->slaves.size(); i++)
	{
		BHandler* slave = handler_member(handler)->slaves[i];
		paintHandler(slave, painter);
	}
}
void member_BViewer::freshHandler(BHandler* handler, const BEvent& event)
{
	if (!handler || !handler->able())
		return;
	handler_member(handler)->fresh(event);
	for (int i = 0; i < handler_member(handler)->slaves.size(); i++)
	{
		BHandler* slave = handler_member(handler)->slaves[i];
		freshHandler(slave, event);
	}
}

void member_BViewer::slotSceneFresh(BObject* object)
{
	boss->fresh();
	if (camera)
		camera_member(camera)->refresh = true;
}
